Part Number Hot Search : 
3DD101 AN8356S 9412A LH1504 B8K350 AD566ASD ND432021 MC13192
Product Description
Full Text Search
 

To Download DM5806 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  DM5806/dm6806 users manual publication no. 5806-8/18/99 ? ? ? ? ? real time devices usa, inc. accessing the analog world ?

? real time devices usa, inc. post office box 906 state college, pennsylvania 16804 phone: (814) 234-8087 fax: (814) 234-5218 DM5806 / dm6806 users manual
published by real time devices usa, inc. p.o. box 906 state college, pa 16804 copyright ? 1992 by real time devices, inc. all rights reserved printed in u.s.a.
table of contents i introduction ................................................................................................................... ................. i -1 digital i/o .................................................................................................................... ........................................... i -3 8254 timer/counter ............................................................................................................. ................................... i -3 what comes with your board ..................................................................................................... .......................... i -3 board accessories .............................................................................................................. ..................................... i -3 using this manual .............................................................................................................. .................................... i -4 when you need help ............................................................................................................. ................................ i -4 chapter 1 board settings .................................................................................................. 1- 1 factory-configured switch and jumper settings .................................................................................. ................ 1-3 p3 interrupt and interrupt channels (factory setting: g connected; interrupt channels disabled) .......... 1-4 p4 interrupt source select (factory setting: ext) ........................................................................... .......... 1-5 p5 8254 timer/counter clock sources (factory settings: clk0-osc, clk1-ot0, clk2-ot1) ........... 1-5 s1 base address (factory setting: 300 hex (768 decimal)) ..................................................................... .... 1-6 s2 buffer bypass switch (factory setting: open (not bypassed)) ........................................................... 1-7 f1 external +5-volt fuse ..................................................................................................... ......................... 1-7 pull-up/pull-down resistors on digital i/o lines ............................................................................... .................. 1-8 chapter 2 board installation ....................................................................................... 2-1 board installation ............................................................................................................. ...................................... 2-3 external i/o connections ....................................................................................................... ................................ 2-4 connecting the digital i/o ..................................................................................................... ............................ 2-4 connecting the timer/counter i/o ............................................................................................... ..................... 2-4 connecting the external interrupt .............................................................................................. ........................ 2-4 running the 806diag diagnostics program ........................................................................................ ................ 2-5 chapter 3 hardware description ................................................................................. 3-1 digital i/o, 8255 programmable peripheral interface ........................................................................... ............... 3-3 timer/counters ................................................................................................................. ..................................... 3-4 interrupts ..................................................................................................................... ........................................... 3-4 chapter 4 board operation and programming ................................................... 4-1 defining the i/o map ........................................................................................................... .................................. 4-3 ba + 0: ppi port a digital i/o (read/write) ................................................................................. ............. 4-3 ba + 1: ppi port b digital i/o (read/write) ................................................................................. ............. 4-3 ba + 2: ppi port c digital i/o (read/write) .................................................................................. ............. 4-3 ba + 3: 8255 ppi control word (write only) .................................................................................... ............. 4-4 ba + 4: irq enable (write only) ............................................................................................... ..................... 4-5 ba + 5: interrupt status/clear (read/write) ................................................................................... ................. 4-5 ba + 6: reserved .............................................................................................................. ................................ 4-6 ba + 7: reserved .............................................................................................................. ................................ 4-6 ba + 8: 8254 timer/counter 0 (read/write) ..................................................................................... .............. 4-6 ba + 9: 8254 timer/counter 1 (read/write) ..................................................................................... .............. 4-6 ba + 10: 8254 timer/counter 2 (read/write) .................................................................................... ............. 4-6 ba + 11: 8254 control word (write only) ....................................................................................... .............. 4-6
ii programming the DM5806 ......................................................................................................... ........................... 4-7 clearing and setting bits in a port ............................................................................................ ........................ 4-8 initializing the 8255 ppi ...................................................................................................... .............................. 4-9 digital i/o operations ......................................................................................................... .............................. 4-9 timer/counters ................................................................................................................. ................................. 4-9 interrupts ..................................................................................................................... ..................................... 4-11 what is an interrupt? .......................................................................................................... ......................... 4-11 interrupt request lines ........................................................................................................ ....................... 4-11 8259 programmable interrupt controller ......................................................................................... ........... 4-11 interrupt mask register (imr) .................................................................................................. .................. 4-11 end-of-interrupt (eoi) command ................................................................................................. ............. 4-11 what exactly happens when an interrupt occurs? ................................................................................. .. 4-11 using interrupts in your programs .............................................................................................. ............... 4-12 writing an interrupt service routine (isr) ..................................................................................... ........... 4-12 saving the startup interrupt mask register (imr) and interrupt vector ................................................... 4-13 restoring the startup imr and interrupt vector ................................................................................. ........ 4-14 common interrupt mistakes ...................................................................................................... .................. 4-14 example programs ............................................................................................................... ................................ 4-14 c and pascal programs .......................................................................................................... .......................... 4-14 basic programs ................................................................................................................. ............................ 4-14 appendix a DM5806 specifications .................................................................................. a-1 appendix b i/o connector pin assignments ............................................................. b-1 appendix c component data sheets ............................................................................. c-1 appendix d warranty .......................................................................................................... .. d-1
iii list of illustrations 1-1 board layout showing factory-configured settings ............................................................................ .. 1-3 1-2 interrupt and interrupt channel jumper, p3 .................................................................................. ........... 1-4 1-3 pulling down the interrupt request line ..................................................................................... ........... 1-4 1-4 interrupt source select jumper, p4 .......................................................................................... ................ 1-5 1-5 8254 timer/counter clock source jumpers, p5 ................................................................................. ..... 1-5 1-6 8254 timer/counter circuit block diagram .................................................................................... ....... 1-6 1-7 base address switch, s1 ..................................................................................................... ..................... 1-6 1-8 port c buffer circuitry ..................................................................................................... ........................ 1-8 1-9 port b pull-up/pull-down resistor circuitry ................................................................................. .......... 1-9 1-10 adding pull-ups and pull-downs to some digital i/o lines ................................................................... 1-9 2-1 p2 and p6 i/o connector pin assignments ..................................................................................... ......... 2-4 3-1 DM5806 block diagram ........................................................................................................ .................. 3-3 4-1 8254 timer/counter circuit block diagram .................................................................................... ..... 4-10
iv
i -1 introduction
i -2
i -3 the DM5806 datamodule? general purpose digital i/o board turns your ibm pc-compatible cpumodule? or other pc/104 computer into a high-performance control system. ultra-compact for embedded and portable applica- tions, the DM5806 board features: ? 24 ttl/cmos 8255-based programmable digital i/o lines, ? direct connection to opto-22 i/o system modules, ? buffered outputs for high driving capability, ? optional pull-up/pull-down resistors, ? simple i/o or strobed i/o operation, ? three 16-bit, 8 mhz timer/counters, ? software enabled interrupts (irq2-irq7), ? requires +5 volts only for operation, ? basic, turbo pascal, and turbo c source code; diagnostics program. the following paragraphs briefly describe the major function of the board. a more detailed discussion of board functions is included in chapter 3, hardware operation , and chapter 4, board operation and programming . the board setup is described in chapter 1, board settings . digital i/o the DM5806 has 24 ttl/cmos-compatible digital i/o lines which can be directly interfaced with external devices or signals to sense switch closures, trigger digital events, or activate solid-state relays. these lines are provided by the on-board 8255 programmable peripheral interface chip. the 8255 can be operated in one of two modes: mode 0 or mode 1. to ensure high driving capacity, cmos buffers are installed. ttl buffers are available on request. pads for installing and activating pull-up or pull-down resistors are included on the board. installation proce- dures are given at the end of chapter 1, board settings . 8254 timer/counter an 8254 programmable interval timer contains three 16-bit, 8 mhz timer/counters to support a wide range of timing and counting functions. the clock, gate, and output pins for each of the timer/counters are available at p6, a 20-pin right angle connector. what comes with your board you receive the following items in your DM5806 package: ? DM5806 interface board with stackthrough bus header ? software and diagnostics diskette with basic, turbo pascal, and turbo c source code ? users manual if any item is missing or damaged, please call real time devices customer service department at (814) 234-8087. if you require service outside the u.s., contact your local distributor. board accessories in addition to the items included in your DM5806 package, real time devices offers a full line of accessories. call your local distributor or our main office for more information about these accessories and for help in choosing the best items to support your boards application. accessories for the DM5806 include the tb50 terminal board and xb50 prototype/terminal board for proto- type development and easy signal access, the dm14 extender board for testing your module in a pc compatible computer, the xo50 opto-22 cable for connection to opto-22 systems, and xt50 twisted pair wire flat ribbon cable assembly for external interfacing.
i -4 at bus connector (dm6806) the dm6806 is exactly the same as the DM5806 except for the addition of the at bus connector . this allows you to stack the module with cpu's that have at bus connectors. using this manual this manual is intended to help you install your new board and get it running quickly, while also providing enough detail about the board and its functions so that you can enjoy maximum use of its features even in the most complex applications. we assume that you already have an understanding of data acquisition principles and that you can customize the example software or write your own applications programs. when you need help this manual and the example programs in the software package included with your board provide enough information to properly use all of the boards features. if you have any problems installing or using this board, contact our technical support department, (814) 234-8087, during regular business hours, eastern standard time or eastern daylight time, or send a fax requesting assistance to (814) 234-5218. when sending a fax request, please include your companys name and address, your name, your telephone number, and a brief description of the problem.
1-1 chapter 1 board settings the DM5806 board has jumper and switch settings you can change if necessary for your application. the board is factory- configured with the most often used settings. the factory settings are listed and shown on a diagram in the beginning of this chapter. should you need to change these settings, use these easy-to-follow instructions before you install the board in your computer. note that dip switch s2 has been provided to bypass the port c buffers and allow mode 1 operation of the 8255. also note that by installing resistor packs at four locations near the 8255 ppi and soldering jumpers in the desired locations in the associated pads, you can configure your digital i/o lines to be pulled up or pulled down. this procedure is explained at the end of this chapter.
1-2
1-3 table 1-1: factory settings switch/ jumper function controlled factory settings (jumpers installed) p3 connects 1 of 6 interrupt sources to an interrupt channel; pulls tri-state buffer to ground (g) for multiple interrupt applications g (ground for buffer) connected; interrupt channels disabled p4 selects the interrupt source ext (external interrupt) p5 sets the clock sources for the three 8254 timer/counters (tc0-tc2) clk0-osc; clk1-ot0; clk2eot1 (all three timer/counters are cascaded) s1 sets the base address 300 hex (768 decimal) s2 bypasses port c buffers for mode 1 operation open (buffers not bypassed) factory-configured switch and jumper settings table 1-1 lists the factory settings of the user-configurable jumper and switches on the DM5806 board. figure 1-1 shows the board layout and the locations of the factory-set jumpers. the following paragraphs explain how to change the factory settings. pay special attention to the setting of s1, the base address switch, to avoid address contention when you first use your board in your system. 82c54 82c55 c6 c6 74hct367 ot2 ot1 ot0 pc0 pc3 ext clk2 clk1 clk0 ec2 osc ot1 ec1 osc ot0 ec0 osc accessing the analog world ,, , , p6 c4 u4 s2 c1 u1 pa pb u5 c5 pb g v pch pch g v pcl g v pcl c3 u3 u11 p5 p4 u10 c10 u6 y1 s1 rn1 c8 u8 c7 u7 irq r1 p3 c9 u9 rn2 c2 u2 pa g v f1 c12 pal 74hct688 74hct245 74hct245 74hct245 switch 74hct243 74hct243 + p2 j1b j1a p1a p1b 1 made in usa 32 real time devices usa xtal base address switch pal 2 3 4 5 6 7 g rn7 fig. 1-1 board layout showing factory-configured settings
1-4 p3 interrupt and interrupt channels (factory setting: g connected; interrupt channels disabled) this header connector, shown in figure 1-2, lets you connect an interrupt source selected on p4 to an interrupt channel, irq2 through irq7. to connect the interrupt source to an interrupt channel, you must install a jumper across the desired irq channel. 2 3 4 5 6 7 g p3 irq fig. 1-2 interrupt and interrupt channel jumper, p3 interrupt +5 v interrupt register int source clr irq status p3 g clr clk fig. 1-3 pulling down the interrupt request line the bottom pair of pins on p3, labeled g, are provided so that you can install a jumper which connects a 1 kilohm pull-down resistor to the output of a high-impedance tri-state driver which carries the interrupt request signal. this pull-down resistor drives the interrupt request line low whenever interrupts are not active. so, whenever an interrupt request is made, the tri-state buffer is enabled, forcing the output high and causing an interrupt. you can monitor the interrupt status through bit 0 in the status word (i/o address location ba + 5). after the interrupt has been serviced, the clear command returns the irq line low, disabling the tri-state buffers, and pulling the output low again. figure 1-3 shows this circuit. because the interrupt request line is driven low only by the pull-down resistor, you can have two or more boards which share the same irq channel. you can tell which board issued the interrupt request by monitoring each boards irq status bit. note: when you use multiple boards that share the same interrupt, only one board should have the g ground jumper installed. the rest should be disconnected. whenever you operate a single board, the g jumper should be installed.
1-5 p4 interrupt source select (factory setting: ext) this header connector, shown in figure 1-4, lets you connect one of six interrupt sources for interrupt genera- tion. these sources are: ot0, ot1, and ot2, which are the three 8254 timer/counter outputs; pc3, which is the intra signal from the 8255 ppi; pc0, which is the intrb signal from the 8255 ppi; and ext, an external interrupt you can route onto the board through the p2 i/o connector. to connect an interrupt source, place the jumper across the desired set of pins. note that only one interrupt source can be activated at a time. fig. 1-4 interrupt source select jumper, p4 ext pc3 pc0 ot0 ot1 ot2 p4 p5 8254 timer/counter clock sources (factory settings: clk0-osc, clk1-ot0, clk2-ot1) this header connector, shown in figure 1-5, lets you select the clock sources for the 8254 timer/counters, tc0, tc1, and tc2. the factory setting cascades all three timer/counters, with the clock source for tc0 being the on- board 8 mhz oscillator, the output of tc0 providing the clock for tc1, and the output of tc1 providing the clock for tc2. you can connect any or all of the sources to an external clock input through the p6 on-board i/o connector, or you can set tc1 and tc2 to be clocked by the 8 mhz oscillator. figure 1-6 shows a block diagram of the timer/ counter circuitry to help you with these connections. note: when installing jumpers on this header, make sure that only one jumper is installed in each group of two or three clk pins. osc ec0 ot0 osc ec1 ot1 osc ec2 fig. 1-5 8254 timer/counter clock source jumpers, p5 p5 clk2 clk0 clk1
1-6 clk1 clk2 clk0 on-board i/o connector p6 pin 17 pin 13 pin 15 8254 timer/ counter 0 clk gate out timer/ counter 1 clk gate out timer/ counter 2 clk gate out pin 10 pin 18 osc(8 mhz) p5 +5 v +5 v +5 v pin 11 pin 12 pin 14 pin 16 t/c out 0 ot 0 ot1 ext clk 0 t/c out 1 ext clk 1 ext gate 2 t/c out 2 ext clk 2 ext gate 0 ext gate 1 fig. 1-6 8254 timer/counter circuit block diagram s1 base address (factory setting: 300 hex (768 decimal)) one of the most common causes of failure when you are first trying your board is address contention. some of your computers i/o space is already occupied by internal i/o and other peripherals. when the DM5806 board attempts to use i/o address locations already used by another device, contention results and the board does not work. to avoid this problem, the DM5806 has an easily accessible dip switch, s1, which lets you select any one of 32 starting addresses in the computers i/o. should the factory setting of 300 hex (768 decimal) be unsuitable for your system, you can select a different base address simply by setting the switches to any value shown in table 1-2. the table shows the switch settings and their corresponding decimal and hexadecimal (in parentheses) values. make sure that you verify the order of the switch numbers on the switch (1 through 5) before setting them. when the switches are pulled forward, they are open, or set to logic 1, as labeled on the dip switch package. when you set the base address for your board, record the value in the table inside the back cover. figure 1-7 shows the dip switch set for a base address of 300 hex (768 decimal). fig. 1-7 base address switch, s1
1-7 s2 buffer bypass switch (factory setting: open (not bypassed)) when operating the 8255 in mode 1, the lines of port c function as control lines, some as outputs and some as inputs. when using mode 1, the port c buffers must be removed and bypassed to allow the port c lines to be individually set as inputs or outputs. figure 1-8 shows the port c buffers, and the following steps tell you how to configure the board for mode 1 operation. to remove buffering from port c: 1. close dip switches 1 through 8 on s2. 2. remove u3 from the board. 3. remove u4 from the board. caution: remember, whenever you close the switches, be sure to remove the buffers, u3 and u4, from the board. failure to do so may damage the board. f1 external +5-volt fuse this 1 ampere fuse protects the +5 volt line available at i/o connector p2, pin 49 from drawing too much current and damaging system equipment. table 1-2: base address switch settings, s1 base address decimal / (hex) switch setting 5 4 3 2 1 base address decimal / (hex) switch setting 5 4 3 2 1 512 / (200) 0 0 0 0 0 768 / (300) 1 0 0 0 0 528 / (210) 0 0 0 0 1 784 / (310) 1 0 0 0 1 544 / (220) 0 0 0 1 0 800 / (320) 1 0 0 1 0 560 / (230) 0 0 0 1 1 816 / (330) 1 0 0 1 1 576 / (240) 0 0 1 0 0 832 / (340) 1 0 1 0 0 592 / (250) 0 0 1 0 1 848 / (350) 1 0 1 0 1 608 / (260) 0 0 1 1 0 864 / (360) 1 0 1 1 0 624 / (270) 0 0 1 1 1 880 / (370) 1 0 1 1 1 640 / (280) 0 1 0 0 0 896 / (380) 1 1 0 0 0 656 / (290) 0 1 0 0 1 912 / (390) 1 1 0 0 1 672 / (2a0) 0 1 0 1 0 928 / (3a0) 1 1 0 1 0 688 / (2b0) 0 1 0 1 1 944 / (3b0) 1 1 0 1 1 704 / (2c0) 0 1 1 0 0 960 / (3c0) 1 1 1 0 0 720 / (2d0) 0 1 1 0 1 976 / (3d0) 1 1 1 0 1 736 / (2e0) 0 1 1 1 0 992 / (3e0) 1 1 1 1 0 752 / (2f0) 0 1 1 1 1 1008 / (3f0) 1 1 1 1 1 0 = closed, 1 = open
1-8 pin 15 pin 13 pin 11 pin 9 dio24 i/o connector p2 buffer u4 buffer u3 82c55 port c s2 pin 7 pin 5 pin 3 pin 1 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 1 2 3 4 5 6 7 8 fig. 1-8 port c buffer circuitry pull-up/pull-down resistors on digital i/o lines the 8255 programmable peripheral interface provides 24 parallel ttl/cmos compatible digital i/o lines which can be interfaced with external devices. the lines are divided into four groups: eight port a lines, four port c lower lines, eight port b lines, and four port c upper lines. you can install and connect pull-up or pull-down resistors for any or all of these four groups of lines. you may want to pull lines up for connection to switches. this will pull the line high when the switch is disconnected. or, you may want to pull down lines connected to relays which control turning motors on and off. these motors turn on when the digital lines controlling them are high. to use the pull-up/pull-down feature, you must first install 10 kilohm resistor packs in any or all of the four locations around the 8255, labeled pa, pb, pcl, and pch. pa and pb, located to the right of the 8255, take a 10-pin pack, and pcl and pch, located along the top edge of the board, take 6-pin packs. figure 1-9 shows these locations. after the resistor packs are installed, you must connect them into the circuit as pull-ups or pull-downs. locate the three-hole pads on the board near the resistor packs. they are labeled g (for ground) on one end and v (for vcc) on the other end. the middle hole is common. pa is for port a, pb for port b, pcl is for port c lower, and pch is for port c upper. figure 1-9 shows a blowup of the pads for port a. to operate as pull-ups, solder a jumper wire between the common pin (middle pin of the three) and the v pin. for pull-downs, solder a jumper wire between the common pin (middle pin) and the g pin. for example, figure 1-10 shows port a lines with pull-ups, port c lower with pull-downs, and port c upper with no resistors.
1-9 82c54 82c55 c6 c6 74hct367 ot2 ot1 ot0 pc0 pc3 ext clk2 clk1 clk0 ec2 osc ot1 ec1 osc ot0 ec0 osc accessing the analog world ,, , , p6 c4 u4 s2 c1 u1 pa pb u5 c5 pb g v pch pch g v pcl g v pcl c3 u3 u11 p5 p4 u10 c10 u6 y1 s1 rn1 c8 u8 c7 u7 irq r1 p3 c9 u9 rn2 c2 u2 pa g v f1 c12 pal 74hct688 74hct245 74hct245 74hct245 switch 74hct243 74hct243 + p2 j1b j1a p1a p1b 1 made in usa 32 real time devices usa xtal base address switch pal 2 3 4 5 6 7 g rn7 8255 port a (pa0-7) vg pa +5 v pull-up port c lower (pa0-3) vg cl +5 v pull-down 10k 10k port c upper (pa4-7) vg ch +5 v fig. 1-10 adding pull-ups and pull-downs to some digital i/o lines fig. 1-9 port b pull-up/pull-down resistor circuitry pb u5 pb g v 74hct245
1-10
2-1 chapter 2 board installation the DM5806 board is easy to install in your cpumodule? or other pc/104 based system. this chapter tells you step-by-step how to install and connect the board. after you have installed the board and made all of your con- nections, you can turn your system on and run the 5806diag board diagnostics program included on your example software disk to verify that your board is working.
2-2
2-3 board installation keep the board in its antistatic bag until you are ready to install it in your cpumodule? or other pc/104 based system. when removing it from the bag, hold the board at the edges and do not touch the components or connectors. before installing the board in your system, check the jumper and switch settings. chapter 1 reviews the factory settings and how to change them. if you need to change any settings, refer to the appropriate instructions in chapter 1. note that incompatible jumper settings can result in unpredictable board operation and erratic response. the DM5806 comes with a stackthrough p1 connector. the stackthrough connector lets you stack another board on top of your DM5806, plugging it into the data bus through the pins on the non-component side of the board (the side which faces up when the board is installed in the system). to install the board, follow the procedures described in the computer manual and the steps below: 1. turn off the power to your system. 2. touch the metal rack to discharge any static buildup and then remove the board from its antistatic bag. 3. select the appropriate standoffs for your application to secure the board when you install it in your system (two sizes are included). 4. holding the board by its edges, orient it so that the p1 bus connectors pin 1 lines up with pin 1 of the expansion connector onto which you are installing the board. 5. after carefully positioning the board so that the card edge connector is resting on the expansion connector, gently and evenly press down on the board until it is secured on the connector. note: do not force the board onto the connector. if the board does not slide into place, remove it and try again. wiggling the board or exerting too much pressure can result in damage to the DM5806 or to the computer board. 6. after the board is installed, connect the 50-pin cable to i/o connector p2 on the board and a 20-pin cable to on-board connector p6 (if desired). when making these connections, note that there is no keying to guide you in orientation. make sure that pin 1 of p2s cable is connected to pin 1 of p2 (pin 1 is marked on the board with a small square). for twisted pair cables, pin 1 is the dark brown wire; for standard single wire cables, pin 1 is the red wire. pin 1 on p6 is also marked on the board with a small square. 7. make sure all connections are secure. external i/o connections figure 2-1 shows the dm806s p2 i/o connector pinout and p6 on-board i/o connector pinout. refer to these diagrams as you make your i/o connections.
2-4 pc0 pc2 pc4 pc6 digital gnd ext gate 0 ext clk 1 t/c out 1 ext gate 2 digital gnd pc1 pc3 pc5 pc7 ext clk 0 t/c out 0 ext gate 1 ext clk 2 t/c out 2 digital gnd 19 20 17 18 15 16 13 14 11 12 9 10 7 8 5 6 3 4 1 2 pc0 pc1 pc2 pc3 pc4 pc5 pc6 pc7 pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 +5 volts extint digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd 39 40 37 38 35 36 33 34 31 32 29 30 27 28 25 26 23 24 21 22 19 20 17 18 15 16 13 14 11 12 9 10 7 8 5 6 3 4 1 2 49 50 47 48 45 46 43 44 41 42 p6 20-pin on-board i/o connector p2 50-pin i/o connector fig. 2-1 p2 and p6 i/o connector pin assignments connecting the digital i/o the DM5806 is designed for direct connection to industry standard opto-22 isolated i/o racks and system modules. each digital i/o line on p2 has a digital ground, as shown in figure 2-1. for all digital i/o connections, the high side of an external signal source or destination device is connected to the appropriate signal pin on the i/o connector, and the low side is connected to the digital gnd. a cable to provide direct connection to opto-22 systems, the xo50, is available as an accessory from rtd. connecting the timer/counter i/o external connections to the timer/counters on the DM5806 can be made by connecting the high side of the external device to the appropriate signal pin on on-board connector p6 and the low side to a p6 digital gnd. connecting the external interrupt the DM5806 can receive an externally generated interrupt signal, extint, through i/o connector p2, pin 2 and route it to an irq channel through on-board header connectors p3 and p4. interrupt generation is enabled through software. when interrupts are enabled, a rising edge on the extint line will cause the selected irq line to go high, and the irq status bit will change from 0 to 1. the pulse applied to the extint pin should have a duration of at least 100 nanoseconds. running the 5806diag diagnostics program now that your board is ready to use, you will want to try it out. an easy-to-use, menu-driven diagnostics program, 5806diag, is included with your example software to help you verify your boards operation. you can also use this program to make sure that your current base address setting does not contend with another device.
3-1 chapter 3 hardware description this chapter describes the major features of the DM5806s 8255 based digital i/o and 8254 timer/counters. this chapter also describes the hardware-selectable interrupts.
3-2
3-3 the DM5806 provides buffered digital i/o lines and three 16-bit timer/counters, as shown figure 3-1. this chapter describes the hardware which makes up the digital i/o circuitry, timer/counters, and hardware-selectable interrupts. fig. 3-1 dm806 block diagram digital i/o, 8255 programmable peripheral interface the 8255 programmable peripheral interface (ppi) can be easily configured to solve a wide range of digital real-world problems. this high-performance ttl/cmos compatible chip has 24 parallel programmable digital i/o lines divided into two groups of 12 lines each: group a port a (8 lines) and port c upper (4 lines); group b port b (8 lines) and port c lower (4 lines). each group can be programmed for mode 0 or mode 1 operation. do not try to use mode 2 operation! the DM5806 does not support mode 2. when operating in mode 1, the on-board buffers must be removed from the port c lines. this procedure is described in chapter 1 in the s2 dip switch discussion. the DM5806 operating modes are: mode 0 basic input/output. lets you use simple input and output operation for a port. data is written to or read from the specified port. mode 1 strobed input/output. lets you transfer i/o data from port a or port b in conjunction with strobes or handshaking signals. these modes are detailed in the 8255 data sheet, reprinted from intel in appendix c. the bidirectional buffers on the 8255s i/o lines monitor the 8255 control word to automatically set their direction. hardware changes to the buffer circuitry is required only when using mode 1, where the port c buffers must be removed as described in chapter 1. +5 volts digital ground 24 address decode buffer and interrupt control address data control i/o connector p c b u s extint buffers and pull-up/down resistors 8255 ppi 24 4 8254 pit 8mhz osc i/o connector 9 3
3-4 timer/counters an 8254 programmable interval timer provides three 16-bit, 8 mhz timer/counters to support a wide range of timing and counting functions. these timer/counters can be cascaded or used individually for many applications. each timer/counter has two inputs, clk in and gate in, and one output, timer/counter out. the clock sources for the timer/counters can be selected using jumpers on header connector p5 (see chapter 1). the timer/ counters can be programmed as binary or bcd down counters by writing the appropriate data to the command word, as described in chapter 4. the command word also lets you set up the mode of operation. the six programmable modes are: mode 0 event counter (interrupt on terminal count) mode 1 hardware-retriggerable one-shot mode 2 rate generator mode 3 square wave mode mode 4 software-triggered strobe mode 5 hardware triggered strobe (retriggerable) these modes are detailed in the 8254 data sheet, reprinted from intel in appendix c. interrupts the DM5806 can use any one of six signal sources to generate interrupts. these sources are: ot0, ot1, and ot2, which are the three 8254 timer/counter outputs; pc3, which is the intra signal from the 8255 ppi; pc0, which is the intrb signal from the 8255 ppi; and ext, an external interrupt you can route onto the board through the p2 i/o connector. chapter 1 tells you how to set the jumpers on interrupt header connectors p3 and p4, and chapter 4 provides some programming information.
4-1 chapter 4 board operation and programming this chapter shows you how to program and use your DM5806 board. it provides a complete description of the i/o map and a detailed description of programming operations to aid you in programming. the example programs included on the disk in your board package are listed at the end of this chapter. these programs, written in turbo c, turbo pascal, assembly, and basic, include source code to simplify your applications programming.
4-2
4-3 defining the i/o map the i/o map for the DM5806 is shown in table 4-1 below. as shown, the board occupies 12 consecutive i/o port locations. the base address (designated as ba) can be selected using dip switch s1 as described in chapter 1, board settings . this switch can be accessed without removing the board from the connectorr. the following sections describe the register contents of each address used in the i/o map. ba + 0: ppi port a digital i/o (read/write) transfers the 8-bit port a digital input and digital output data between the board and an external device. a read transfers data from the external device, through p2, and into ppi port a; a write transfers the written data from port a through p2 to an external device. ba + 1: ppi port b digital i/o (read/write) transfers the 8-bit port b digital input and digital output data between the board and an external device. a read transfers data from the external device, through p2, and into ppi port b; a write transfers the written data from port b through p2 to an external device. ba + 2: ppi port c digital i/o (read/write) transfers the two 4-bit port c digital input and digital output data groups (port c upper and port c lower) between the board and an external device. a read transfers data from the external device, through p2 and p6, and into ppi port c; a write transfers the written data from port c through p2 and p6 to an external device. table 4-1: DM5806 i/o map register description read function write function address * (decimal) 8255 ppi port a read port a digital input lines program port a digital output lines ba + 0 8255 ppi port b read port b digital input lines program port b digital output lines ba + 1 8255 ppi port c read port c digital input lines program port c digital output lines ba + 2 8255 ppi control word not used program ppi configuration ba + 3 irq enable not used enable and disable interrupt generation ba + 4 interrupt status/clear read status of interrupt clear interrupt ba + 5 reserved ba + 6 reserved ba + 7 8254 timer/counter 0 read tc0 count value load tc0 count register ba + 8 8254 timer/counter 1 read tc1 count value load tc1 count register ba + 9 8254 timer/counter 2 read tc2 count value load tc2 count register ba + 10 8254 control word not used program control register ba + 11 * ba = base address
4-4 ba + 3: 8255 ppi control word (write only) when bit 7 of this word is set to 1, a write programs the ppi configuration. bit 6 must always be set to 0 (mode 2 operation is not supported by the DM5806). the table below shows the control words for the 16 possible mode 0 port i/o combinations. d7 d6 d5 d4 d3 d2 d1 d0 port c lower 0 = output 1 = input port b 0 = output 1 = input mode set flag 1 = active port c upper 0 = output 1 = input port a 0 = output 1 = input group b mode select 00 = mode 0 01 = mode 1 1x = mode 2 mode select 0 = mode 0 1 = mode 1 1 0xxxxxx group a 8255 port i/o flow direction and control words, mode 0 group a group b control word port a port c upper port b port c lower binary decimal hex output output output output 1 0 0 0 0 0 0 0 128 80 output output output input 1 0 0 0 0 0 0 1 129 81 output output input output 1 0 0 0 0 0 1 0 130 82 output output input input 1 0 0 0 0 0 1 1 131 83 output input output output 1 0 0 0 1 0 0 0 136 88 output input output input 1 0 0 0 1 0 0 1 137 89 output input input output 1 0 0 0 1 0 1 0 138 8a output input input input 1 0 0 0 1 0 1 1 139 8b input output output output 1 0 0 1 0 0 0 0 144 90 input output output input 1 0 0 1 0 0 0 1 145 91 input output input output 1 0 0 1 0 0 1 0 146 92 input output input input 1 0 0 1 0 0 1 1 147 93 input input output output 1 0 0 1 1 0 0 0 152 98 input input output input 1 0 0 1 1 0 0 1 153 99 input input input output 1 0 0 1 1 0 1 0 154 9a input input input input 1 0 0 1 1 0 1 1 155 9b
4-5 d7 d6 d5 d4 d3 d2 d1 d0 set/reset function bit 0 = active bit set/reset 0 = set bit to 0 1 = set bit to 1 when bit 7 of this word is set to 0, a write can be used to individually program the port c lines. bit select 000 = pc0 001 = pc1 010 = pc2 011 = pc3 100 = pc4 101 = pc5 110 = pc6 111 = pc7 for example, if you want to set port c bit 0 to 1, you would set up the control word so that bit 7 is 0; bits 1, 2, and 3 are 0 (this selects pc0); and bit 0 is 1 (this sets pc0 to 1). the control word is set up like this: d7 d6 d5 d4 d3 d2 d1 d0 set/reset function bit bit select 000 = pc0 set pc0 x = dont care sets pc0 to 1: (written to ba +3) 0xxx0001 ba + 4: irq enable (write only) enables and disables interrupt generation. writing a 1 enables interrupt generation; writing a 0 disables interrupt generation. d7 d6 d5 d4 d3 d2 d1 d0 interrupt enable/disable 0 = interrupt disabled 1 = interrupt enabled 0000000 d7 d6 d5 d4 d3 d2 d1 d0 interrupt status 0 = no interrupt 1 = interrupt has occurred xxxxxxx ba + 5: interrupt status/clear (read/write) a read shows the status of the interrupt (bit 0 only) as defined below. a write clears the interrupt (data written is irrelevant). each time the interrupt status bit goes high, a write should follow to clear the bit.
4-6 ba + 6: reserved ba + 7: reserved ba + 8: 8254 timer/counter 0 (read/write) a read shows the count in the counter, and a write loads the counter with a new value. counting begins as soon as the count is loaded. ba + 9: 8254 timer/counter 1 (read/write) a read shows the count in the counter, and a write loads the counter with a new value. counting begins as soon as the count is loaded. ba + 10: 8254 timer/counter 2 (read/write) a read shows the count in the counter, and a write loads the counter with a new value. counting begins as soon as the count is loaded. ba + 11: 8254 control word (write only) accesses the 8254 control register to directly control the three timer/counters. d7 d6 d5 d4 d3 d2 d1 d0 counter select 00 = counter 0 01 = counter 1 10 = counter 2 11 = read back setting bcd/binary 0 = binary 1 = bcd counter mode select 000 = mode 0, event count 001 = mode 1, programmable 1-shot x10 = mode 2, rate generator x11 = mode 3, square wave rate generator 100 = mode 4, software-triggered strobe 101 = mode 5, hardware-triggered strobe read/load 00 = latching operation 01 = read/load lsb only 10 = read/load msb only 11 = read/load lsb, then msb
4-7 programming the DM5806 this section gives you some general information about programming and the DM5806 board, and then walks you through the major DM5806 programming functions. these descriptions will help you as you use the example programs included with the board. all of the program descriptions in this section use decimal values unless other- wise specified. the DM5806 is programmed by writing to and reading from the correct i/o port locations on the board. these i/o ports were defined in the previous section. most high-level languages such as basic, pascal, c, and c++, and of course assembly language, make it very easy to read/write these ports. the table below shows you how to read from and write to i/o ports using some popular programming languages. language modulus integer division and or c % a = b % c / a = b / c & a = b & c | a = b | c pascal mod a := b mod c div a := b div c and a := b and c or a := b or c basic mod a = b mod c \ a = b \ c and a = b and c or a = b or c in addition to being able to read/write the i/o ports on the DM5806, you must be able to perform a variety of operations that you might not normally use in your programming. the table below shows you some of the operators discussed in this section, with an example of how each is used with pascal, c, and basic. note that the modulus operator is used to retrieve the least significant byte (lsb) of a two-byte word, and the integer division operator is used to retrieve the most significant byte (msb). many compilers have functions that can read/write either 8 or 16 bits from/to an i/o port. for example, turbo pascal uses port for 8-bit port operations and portw for 16 bits, turbo c uses inportb for an 8-bit read of a port and inport for a 16-bit read. be sure to use only 8-bit operations with the DM5806! language read write basic data=inp(address) out address,data turbo c data=inportb(address) outportb(address,data) turbo pascal data:=port[address] port[address]:=data assembly mov dx,address in al,dx mov dx,address mov al,data out dx,al
4-8 clearing and setting bits in a port when you clear or set one or more bits in a port, you must be careful that you do not change the status of the other bits. you can preserve the status of all bits you do not wish to change by proper use of the and and or binary operators. using and and or, single or multiple bits can be easily cleared in one operation. to clear a single bit in a port, and the current value of the port with the value b, where b = 255 - 2 bit . example: clear bit 5 in a port. read in the current value of the port, and it with 223 (223 = 255 - 2 5 ), and then write the resulting value to the port. in basic, this is programmed as: v = inp(portaddress) v = v and 223 out portaddress, v to set a single bit in a port, or the current value of the port with the value b, where b = 2 bit . example: set bit 3 in a port. read in the current value of the port, or it with 8 (8 = 2 3 ), and then write the resulting value to the port. in pascal, this is programmed as: v := port[portaddress]; v := v or 8; port[portaddress] := v; setting or clearing more than one bit at a time is accomplished just as easily. to clear multiple bits in a port, and the current value of the port with the value b, where b = 255 - (the sum of the values of the bits to be cleared). note that the bits do not have to be consecutive. example: clear bits 2 ,4, and 6 in a port. read in the current value of the port, and it with 171 (171 = 255 - 2 2 - 2 4 - 2 6 ), and then write the resulting value to the port. in c, this is programmed as: v = inportb(port_address); v = v & 171; outportb(port_address, v); to set multiple bits in a port, or the current value of the port with the value b, where b = the sum of the individual bits to be set. note that the bits to be set do not have to be consecutive. example: set bits 3, 5, and 7 in a port. read in the current value of the port, or it with 168 (168 = 2 3 + 2 5 + 2 7 ), and then write the resulting value back to the port. in assembly language, this is programmed as: mov dx, portaddress in al, dx or al, 168 out dx, al often, assigning a range of bits is a mixture of setting and clearing operations. you can set or clear each bit individually or use a faster method of first clearing all the bits in the range then setting only those bits that must be set using the method shown above for setting multiple bits in a port. the following example shows how this two- step operation is done. example: assign bits 3, 4, and 5 in a port to 101 (bits 3 and 5 set, bit 4 cleared). first, read in the port and clear bits 3, 4, and 5 by anding them with 199. then set bits 3 and 5 by oring them with 40, and finally write the resulting value back to the port. in c, this is programmed as:
4-9 v = inportb(port_address); v = v & 199; v = v | 40; outportb(port_address, v); a final note: dont be intimidated by the binary operators and and or and try to use operators for which you have a better intuition. for instance, if you are tempted to use addition and subtraction to set and clear bits in place of the methods shown above, dont! addition and subtraction may seem logical, but they will not work if you try to clear a bit that is already clear or set a bit that is already set. for example, you might think that to set bit 5 of a port, you simply need to read in the port, add 32 (2 5 ) to that value, and then write the resulting value back to the port. this works fine if bit 5 is not already set. but, what happens when bit 5 is already set? bits 0 to 4 will be unaffected and we cant say for sure what happens to bits 6 and 7, but we can say for sure that bit 5 ends up cleared instead of being set. a similar problem happens when you use subtraction to clear a bit in place of the method shown above. now that you know how to clear and set bits, we are ready to look at the programming steps for the DM5806 board functions. initializing the 8255 ppi before you can operate the DM5806, the 8255 must be initialized. this step must be executed every time you start up, reset, or reboot your computer. the 8255 is initialized by writing the appropriate control word to i/o port ba + 3. the contents of your control word will vary, depending on how you want to configure your i/o lines. use the control word description in the previous i/o map section to help you program the right value. remember that the DM5806 cannot use mode 2. in the example below, a decimal value of 128 sets up the 8255 so that all i/o lines are mode 0 outputs. digital i/o operations once the 8255 is initialized, you can use the digital i/o lines to control or monitor external devices. timer/counters an 8254 programmable interval timer provides three 16-bit, 8-mhz timer/counters for timing and counting functions such as frequency measurement, event counting, and interrupts. all three timer/counters are cascaded at the factory. figure 4-1 shows the timer/counter circuitry. each timer/counter has two inputs, clk in and gate in, and one output, timer/counter out. they can be programmed as binary or bcd down counters by writing the appropriate data to the command word, as described in the i/o map section at the beginning of this chapter. one of two clock sources, the on-board 8-mhz crystal or an external clock routed through on-board i/o connector p6 can be selected as the clock input to each timer/counter. in addition, the timer/counters can be cas- caded by connecting tc0s output to tc1s clock input and tc1s output to tc2s clock input. the diagram shows how these clock sources are connected to the timer/counters. an external gate source can be connected to each timer/counter through p6. when a gate is disconnected, an on- board pull-up resistor automatically pulls the gate high, enabling the timer/counter. the output from each timer/counter is available at p6, where it can be used for interrupt generation or for counting functions. the timer/counters can be programmed to operate in one of six modes, depending on your application. the following paragraphs briefly describe each mode. d7 d6 d5 d4 d3 d2 d1 d0 10000000
4-10 clk1 clk2 clk0 on-board i/o connector p6 pin 17 pin 13 pin 15 8254 timer/ counter 0 clk gate out timer/ counter 1 clk gate out timer/ counter 2 clk gate out pin 10 pin 18 osc(8 mhz) p5 +5 v +5 v +5 v pin 11 pin 12 pin 14 pin 16 t/c out 0 ot 0 ot1 ext clk 0 t/c out 1 ext clk 1 ext gate 2 t/c out 2 ext clk 2 ext gate 0 ext gate 1 fig. 4-1 8254 timer/counter circuit block diagram mode 0, event counter (interrupt on terminal count). this mode is typically used for event counting. while the timer/counter counts down, the output is low, and when the count is complete, it goes high. the output stays high until a new mode 0 control word is written to the timer/counter. mode 1, hardware-retriggerable one-shot. the output is initially high and goes low on the clock pulse following a trigger to begin the one-shot pulse. the output remains low until the count reaches 0, and then goes high and remains high until the clock pulse after the next trigger. mode 2, rate generator. this mode functions like a divide-by-n counter and is typically used to generate a real-time clock interrupt. the output is initially high, and when the count decrements to 1, the output goes low for one clock pulse. the output then goes high again, the timer/counter reloads the initial count, and the process is repeated. this sequence continues indefinitely. mode 3, square wave mode. similar to mode 2 except for the duty cycle output, this mode is typically used for baud rate generation. the output is initially high, and when the count decrements to one-half its initial count, the output goes low for the remainder of the count. the timer/counter reloads and the output goes high again. this process repeats indefinitely. mode 4, software-triggered strobe. the output is initially high. when the initial count expires, the output goes low for one clock pulse and then goes high again. counting is triggered by writing the initial count. mode 5, hardware triggered strobe (retriggerable). the output is initially high. counting is triggered by the rising edge of the gate input. when the initial count has expired, the output goes low for one clock pulse and then goes high again.
4-11 interrupts - what is an interrupt? an interrupt is an event that causes the processor in your computer to temporarily halt its current process and execute another routine. upon completion of the new routine, control is returned to the original routine at the point where its execution was interrupted. interrupts are very handy for dealing with asynchronous events (events that occur at less than regular intervals). keyboard activity is a good example; your computer cannot predict when you might press a key and it would be a waste of processor time for it to do nothing while waiting for a keystroke to occur. thus, the interrupt scheme is used and the processor proceeds with other tasks. then, when a keystroke does occur, the keyboard interrupts the processor, and the processor gets the keyboard data, places it in memory, and then returns to what it was doing before it was interrupted. other common devices that use interrupts are modems, disk drives, and mice. your DM5806 board can interrupt the processor when one of the six interrupt sources is enabled. by using these interrupts, you can write software that effectively deals with real world events. - interrupt request lines to allow different peripheral devices to generate interrupts on the same computer, the pc bus has eight different interrupt request (irq) lines. a transition from low to high on one of these lines generates an interrupt request which is handled by the pcs interrupt controller. the interrupt controller checks to see if interrupts are to be acknowledged from that irq and, if another interrupt is already in progress, it decides if the new request should supersede the one in progress or if it has to wait until the one in progress is done. this prioritizing allows an interrupt to be interrupted if the second request has a higher priority. the priority level is based on the number of the irq; irq0 has the highest priority, irq1 is second-highest, and so on through irq7, which has the lowest. many of the irqs are used by the standard system resources. irq0 is used by the system timer, irq1 is used by the key- board, irq3 by com2, irq4 by com1, and irq6 by the disk drives. therefore, it is important for you to know which irq lines are available in your system for use by the DM5806 board. - 8259 programmable interrupt controller the chip responsible for handling interrupt requests in the pc is the 8259 programmable interrupt controller. to use interrupts, you will need to know how to read and set the 8259s interrupt mask register (imr) and how to send the end-of-interrupt (eoi) command to the 8259. - interrupt mask register (imr) each bit in the interrupt mask register (imr) contains the mask status of an irq line; bit 0 is for irq0, bit 1 is for irq1, and so on. if a bit is set (equal to 1), then the corresponding irq is masked and it will not generate an interrupt. if a bit is clear (equal to 0), then the corresponding irq is unmasked and can generate interrupts. the imr is programmed through port 21h. for all bits: 0 = irq unmasked (enabled) 1 = irq masked (disabled) i/o port 21h - end-of-interrupt (eoi) command after an interrupt service routine is complete, the 8259 interrupt controller must be notified. this is done by writing the value 20h to i/o port 20h. - what exactly happens when an interrupt occurs? understanding the sequence of events when an interrupt is triggered is necessary to properly write software interrupt handlers. when an interrupt request line is driven high by a peripheral device (such as the DM5806), the irq7 irq6 irq5 irq4 irq3 irq2 irq1 irq0
4-12 interrupt controller checks to see if interrupts are enabled for that irq, and then checks to see if other interrupts are active or requested and determines which interrupt has priority. the interrupt controller then interrupts the proces- sor. the current code segment (cs), instruction pointer (ip), and flags are pushed on the stack for storage, and a new cs and ip are loaded from a table that exists in the lowest 1024 bytes of memory. this table is referred to as the interrupt vector table and each entry is called an interrupt vector. once the new cs and ip are loaded from the interrupt vector table, the processor begins executing the code located at cs:ip. when the interrupt routine is completed, the cs, ip, and flags that were pushed on the stack when the interrupt occurred are now popped from the stack and execution resumes from the point where it was interrupted. - using interrupts in your programs adding interrupts to your software is not as difficult as it may seem, and what they add in terms of performance is often worth the effort. note, however, that although it is not that hard to use interrupts, the smallest mistake will often lead to a system hang that requires a reboot. this can be both frustrating and time-consuming. but, after a few tries, youll get the bugs worked out and enjoy the benefits of properly executed interrupts. - writing an interrupt service routine (isr) the first step in adding interrupts to your software is to write the interrupt service routine (isr). this is the routine that will automatically be executed each time an interrupt request occurs on the specified irq. an isr is different than standard routines that you write. first, on entrance, the processor registers should be pushed onto the stack before you do anything else. second, just before exiting your isr, you must clear the interrupt status of the DM5806 and write an end-of-interrupt command to the 8259 controller. finally, when exiting the isr, in addition to popping all the registers you pushed on entrance, you must use the iret instruction and not a plain ret. the iret automatically pops the flags, cs, and ip that were pushed when the interrupt was called. if you find yourself intimidated by interrupt programming, take heart. most pascal and c compilers allow you to identify a procedure (function) as an interrupt type and will automatically add these instructions to your isr, with one important exception: most compilers do not automatically add the end-of-interrupt command to the procedure; you must do this yourself. other than this and the few exceptions discussed below, you can write your isr just like any other routine. it can call other functions and procedures in your program and it can access global data. if you are writing your first isr, we recommend that you stick to the basics; just something that will convince you that it works, such as incrementing a global variable. note: if you are writing an isr using assembly language, you are responsible for pushing and popping registers and using iret instead of ret. there are a few cautions you must consider when writing your isr. the most important is, do not use any dos functions or routines that call dos functions from within an isr . dos is not reentrant; that is, a dos function cannot call itself. in typical programming, this will not happen because of the way dos is written. but what about when using interrupts? then, you could have a situation such as this in your program. if dos function x is being executed when an interrupt occurs and the interrupt routine makes a call to dos function x, then function x is essentially being called while it is already active. such a reentrancy attempt spells disaster because dos functions are not written to support it. this is a complex concept and you do not need to understand it. just make sure that you do not call any dos functions from within your isr. the one wrinkle is that, unfortunately, it is not obvious which library routines included with your compiler use dos functions. a rule of thumb is that routines which write to the screen, or check the status of or read the keyboard, and any disk i/o routines use dos and should be avoided in your isr. the same problem of reentrancy exists for many floating point emulators as well, meaning you may have to avoid floating point (real) math in your isr. note that the problem of reentrancy exists, no matter what programming language you are using. even if you are writing your isr in assembly language, dos and many floating point emulators are not reentrant. of course, there are ways around this problem, such as those which involve checking to see if any dos functions are currently active when your isr is called, but such solutions are well beyond the scope of this discussion. the second major concern when writing your isr is to make it as short as possible in terms of execution time. spending long periods of time in your isr may mean that other important interrupts are being ignored. also, if you
4-13 spend too long in your isr, it may be called again before you have completed handling the first run. this often leads to a hang that requires a reboot. your isr should have this structure: ? push any processor registers used in your isr. most c and pascal interrupt routines automatically do this for you. ? put the body of your routine here. ? clear the interrupt bit on the DM5806 by writing any value to ba + 5. ? issue the eoi command to the 8259 interrupt controller by writing 20h to port 20h. ? pop all registers pushed on entrance. most c and pascal interrupt routines automatically do this for you. the following c and pascal examples show what the shell of your isr should be like: in c: void interrupt isr(void) { /* your code goes here. do not do not do not do not do not use any dos functions! */ outportb(baseaddress + 5, 0); /* clear DM5806 interrupt */ outportb(0x20, 0x20); /* send eoi command to 8259 */ } in pascal: procedure isr; interrupt; begin { your code goes here. do not do not do not do not do not use any dos functions! } port[baseaddress + 5] := 0; { clear DM5806 interrupt } port[$20] := $20; { send eoi command to 8259 } end; - saving the startup interrupt mask register (imr) and interrupt vector the next step after writing the isr is to save the startup state of the interrupt mask register and the interrupt vector that you will be using. the imr is located at i/o port 21h. the interrupt vector you will be using is located in the interrupt vector table which is simply an array of 256-bit (4-byte) pointers and is located in the first 1024 bytes of memory (segment = 0, offset = 0). you can read this value directly, but it is a better practice to use dos function 35h (get interrupt vector). most c and pascal compilers provide a library routine for reading the value of a vector. the vectors for the hardware interrupts are vectors 8 through 15, where irq0 uses vector 8, irq1 uses vector 9, and so on. thus, if the DM5806 will be using irq3, you should save the value of interrupt vector 11. before you install your isr, temporarily mask out the irq you will be using. this prevents the irq from requesting an interrupt while you are installing and initializing your isr. to mask the irq, read in the current imr at i/o port 21h and set the bit that corresponds to your irq (remember, setting a bit disables interrupts on that irq while clearing a bit enables them). the imr is arranged so that bit 0 is for irq0, bit 1 is for irq1, and so on. see the paragraph entitled interrupt mask register (imr) earlier in this chapter for help in determining your irqs bit. after setting the bit, write the new value to i/o port 21h. with the startup imr saved and the interrupts on your irq temporarily disabled, you can assign the interrupt vector to point to your isr. again, you can overwrite the appropriate entry in the vector table with a direct memory write, but this is a bad practice. instead, use either dos function 25h (set interrupt vector) or, if your compiler provides it, the library routine for setting an interrupt vector. remember that vector 8 is for irq0, vector 9 is for irq1, and so on. if you need to program the source of your interrupts, do that next. for example, if you are using the program- mable interval timer to generate interrupts, you must program it to run in the proper mode and at the proper rate. finally, clear the bit in the imr for the irq you are using. this enables interrupts on the irq.
4-14 C restoring the startup imr and interrupt vector before exiting your program, you must restore the interrupt mask register and interrupt vectors to the state they were in when your program started. to restore the imr, write the value that was saved when your program started to i/o port 21h. restore the interrupt vector that was saved at startup with either dos function 35h (get interrupt vector), or use the library routine supplied with your compiler. performing these two steps will guarantee that the interrupt status of your computer is the same after running your program as it was before your program started running. - common interrupt mistakes ? remember that hardware interrupts are numbered 8 through 15, even though the corresponding irqs are numbered 0 through 7. ? two of the most common mistakes when writing an isr are forgetting to clear the interrupt status of the DM5806 and forgetting to issue the eoi command to the 8259 interrupt controller before exiting the isr. example programs included with the DM5806 is a set of example programs that demonstrate the use of many of the boards features. these examples are in written in c, pascal, assembly, and basic. also included is an easy-to-use menu- driven diagnostics program, 5806diag, which is especially helpful when you are first checking out your board after installation. before using the software included with your board, make a backup copy of the disk. you may make as many backups as you need. c and pascal programs these programs are source code files so that you can easily develop your own custom software for your DM5806 board. digital i/o: digital simple program the shows how to read and write the digital i/o lines. timer/counters: timer a short program demonstrating how to program the 8254 for use as a timer. basic programs these programs include both source code files and executable files so that you can run them on your DM5806. all of the executable programs are set up to look for the board at a base address (ba) of 300 hex (768 decimal). if you change the base address of the board, you must also change the ba in your programs. digital i/o: digital simple program the shows how to read and write the digital i/o lines. timer/counters: timer a short program demonstrating how to program the 8254 for use as a timer.
a-1 appendix a DM5806/dm6806 specifications
a-2
a-3 DM5806 characteristics typical @ 25 c interface switch-selectable base address, i/o mapped jumper-selectable interrupts digital i/o ........................................................................................ cmos 82c55 opto-22 compatible number of lines .......................................................................................................... 24 logic compatibility ....................................................................................... ttl/cmos (configurable with optional i/o pull-up/pull-down resistors) high-level output voltage ................................................................................ 4.2v, min low-level output voltage .............................................................................. 0.45v, max high-level input voltage ................................................................ 2.2v, min; 5.5v, max low-level input voltage ................................................................ -0.3v, min; 0.8v, max high-level output current, isource ..................................... cmos buffer: -12 ma, max; ttl buffer: -16 ma, max low-level output current, isink ............................................ cmos buffer: 24 ma, max; ttl buffer: 64 ma, max input load current ............................................................................................... 10 a input capacitance ................................................................................................. 10 pf input capacitance, c(in)@f=1mhz ................................................................................................. 10 pf output capacitance, c(out)<@f=1mhz .......................................................................................... 20 pf timer/counters .............................................................................. cmos 82c54 three 16-bit down counters 6 programmable operating modes counter input source .................................................... external clock (8 mhz, max) or on-board 8 mhz clock counter outputs .......................................... available externally; used as pc interrupts counter gate source ................................................... external gate or always enabled current requirements 194 ma @ +5 volts connectors p2 50-pin right angle header p6 20-pin right angle header size 3.55"l x 3.775"w x 0.6"h (90mm x 96mm x 16mm)
a-4
b-1 appendix b i/o connector pin assignments
b-2
b-3 50-pin connector p2: 20-pin connector p6: pc0 pc1 pc2 pc3 pc4 pc5 pc6 pc7 pb0 pb1 pb2 pb3 pb4 pb5 pb6 pb7 pa0 pa1 pa2 pa3 pa4 pa5 pa6 pa7 +5 volts extint digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd digital gnd 39 40 37 38 35 36 33 34 31 32 29 30 27 28 25 26 23 24 21 22 19 20 17 18 15 16 13 14 11 12 9 10 7 8 5 6 3 4 1 2 49 50 47 48 45 46 43 44 41 42 pc0 pc2 pc4 pc6 digital gnd ext gate 0 ext clk 1 t/c out 1 ext gate 2 digital gnd pc1 pc3 pc5 pc7 ext clk 0 t/c out 0 ext gate 1 ext clk 2 t/c out 2 digital gnd 19 20 17 18 15 16 13 14 11 12 9 10 7 8 5 6 3 4 1 2
b-4
appendix c component data sheets c-1

intel 82c55a programmable peripheral interface data sheet reprint

intel 82c54 programmable interval timer data sheet reprint

d-1 appendix d warranty
d-2
d-3 limited warranty real time devices, inc. warrants the hardware and software products it manufactures and produces to be free from defects in materials and workmanship for one year following the date of shipment from real time de- vices. this warranty is limited to the original purchaser of product and is not transferable. during the one year warranty period, real time devices will repair or replace, at its option, any defective products or parts at no additional charge, provided that the product is returned, shipping prepaid, to real time devices. all replaced parts and products become the property of real time devices. before returning any product for repair, customers are required to contact the factory for an rma number. this limited warranty does not extend to any products which have been dam- aged as a result of accident, misuse, abuse (such as: use of incorrect input voltages, improper or insufficient ventilation, failure to follow the operating instructions that are provided by real time devices, acts of god or other contingencies beyond the control of real time devices), or as a result of service or modification by anyone other than real time devices. except as ex- pressly set forth above, no other warranties are expressed or implied, including, but not limited to, any implied warranties of merchantability and fitness for a particular purpose, and real time devices expressly disclaims all warranties not stated herein. all implied warranties, including implied warranties for mechantability and fitness for a particular purpose, are limited to the duration of this warranty. in the event the product is not free from defects as warranted above, the purchasers sole remedy shall be repair or replacement as provided above. under no circumstances will real time devices be liable to the purchaser or any user for any damages, including any incidental or consequential dam- ages, expenses, lost profits, lost savings, or other damages arising out of the use or inability to use the product. some states do not allow the exclusion or limitation of incidental or conse- quential damages for consumer products, and some states do not allow limita- tions on how long an implied warranty lasts, so the above limitations or exclu- sions may not apply to you. this warranty gives you specific legal rights, and you may also have other rights which vary from state to state.
d-4

DM5806 board user-selected settings base i/o address: (hex) (decimal)


▲Up To Search▲   

 
Price & Availability of DM5806

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X